import { ConsultType } from "@/enum";
import { PartialConsult,ConsultIllness } from "@/types/consult";
import { defineStore } from "pinia";
import { ref } from "vue";
export const useConsultStore=defineStore(
  'cp-consult',
  ()=>{
    //问诊信息
    const consult=ref<PartialConsult>({})
    //记录问诊类型
    const setType=(type:ConsultType)=>{
      consult.value.type=type
    }
    //记录问诊级别
    const setIllnessType=(type: 0|1)=>{
      consult.value.illnessType=type
    }
    //记录科室信息
    const setDep=(id:string)=>{
      consult.value.depId=id
    }
    //记录病情描述
    const setIllness=(illness:ConsultIllness)=>{
      consult.value.illnessDesc=illness.illnessDesc
      consult.value.illnessTime=illness.illnessTime
      consult.value.consultFlag=illness.consultFlag
      consult.value.pictures=illness.pictures
    }
    //记录患者ID
    const setPatientId=(patientId:string)=>{
      consult.value.patientId=patientId
    }
    //记录优惠券
    const setCoupon=(id:string)=>{
      consult.value.couponId=id
    }
    const clear=()=>{
      consult.value={}
    }
    return {consult,setType,setIllnessType,setDep,setIllness,setPatientId,setCoupon,clear}
  },
  {persist:true})

